$(function () {
    //======================
    //======设置查询条件========
    //======================
//    //内部公司
//    $("#yhck_toolbar [name='yhckgsId']").gsjgtree(1);
    //终止时间
    $("#yhck_mx_toolbar [name='yhckmxendDate']").datebox();
    //终止时间
    $("#yhck_mx_toolbar [name='yhckmxstartDate']").datebox();
    //搜索按钮
    $("#yhck_mx_toolbar [name='searchButton']").click(function () {
        $(grid).datagrid({
            queryParams: {
                endDate: $("#yhck_mx_toolbar [name='yhckmxendDate']").val(),
                startDate: $("#yhck_mx_toolbar [name='yhckmxstartDate']").val(),
                gsId: $("#yhck_mx_gsId").val(),
                zh: $("#yhck_mx_zh").val()
            }});
    });


//======================
//========统计列表========
//======================
    var yhckcolumns = [
        [
            {field: 'rq', title: '日期', width: 50, align: 'center'},
            {field: 'gsmc', title: '公司名称', width: 100, align: 'center'},
            {field: 'khhmc', title: '开户行名称', width: 100, align: 'center'},
            {field: 'jf', title: '借方', align: 'right', width: 100, formatter: function (value) {
                var sl = formatJe2(value, ",");
                return sl;
            }
            },
            {field: 'df', title: '贷方', align: 'right', width: 100, formatter: function (value) {
                var sl = formatJe2(value, ",");
                return sl;
            }
            },
            {field: 'ye', title: '余额', align: 'right', width: 100, formatter: function (value) {
                var sl = formatJe2(value, ",");
                return sl;
            }
            },
            {field: 'bz', title: '备注', width: 200, align: 'center'},
            {field: 'khmc', title: '客户', width: 100, align: 'center'},
            {field: 'bm', title: '单据号', width: 50, align: 'center'}
        ]
    ];

    var grid = $('#yhck_mx_grid').datagrid({
        url: $.webPath() + '/report/yhck/yhckmxList',
        toolbar: "#yhck_mx_toolbar",
        rownumbers: true,
        singleSelect: true,
        collapsible: true,
        fit: true,
        fitColumns: true,
        showFooter: true,
        queryParams: {
            gsId: $("#yhck_mx_gsId").val(),
            zh: $("#yhck_mx_zh").val(),
            endDate: $("#yhck_mx_toolbar [name='yhckmxendDate']").val(),
            startDate: $("#yhck_mx_toolbar [name='yhckmxstartDate']").val()
        },
        columns: yhckcolumns
    });
});
